home *** CD-ROM | disk | FTP | other *** search
- /*************************************************************************
- ** DrawCircle.rexx **
- ** this Rexx-Script supplies a Draw-Circle function **
- ** however, this could be done better, this is just a demonstration... **
- ** (need rexxmathlib, ignores line-style) **
- ** © THOR 1995 **
- *************************************************************************/
-
- 'getrange' 'brush_line' 'pos'
- if pos.count=2 then
- do
- pi=3.1415926
- twopi=2*pi
- xm=pos.x.0
- ym=pos.y.0
- deltax=pos.x.0-pos.x.1
- deltay=pos.y.0-pos.y.1
- r=sqrt(deltax*deltax+deltay*deltay)
- stps=2*int(r)
- if stps<2 then
- stps=2
- incr=pi/stps
- 'lockgui'
- 'lockundo'
- 'fetchundo'
- 'pushtool' 'cell_window' 'lines' 'left' 'left'
- do arg=0 to twopi+incr by incr
- if arg=0 then
- do
- x1=r*cos(arg)+xm
- y1=r*sin(arg)+ym
- 'inside' x1 y1 'in'
- if in='TRUE' then
- 'click' x1 y1
- end
- else
- do
- x2=r*cos(arg)+xm
- y2=r*sin(arg)+ym
- 'inside' x1 y1 'in'
- 'inside' x2 y2 'in2'
- if (in='TRUE') & (in2='TRUE') then
- 'drag' x1 y1 x2 y2
-
- x1=x2
- y1=y2
- end
- end
- 'unlockundo'
- 'unlockgui'
- end
-
-